#!/usr/bin/evn python
#coding:utf-8
from polls.models import Poll, Choice
from django.contrib import admin

#class ChoiceInline(admin.StackedInline):
class ChoiceInline(admin.TabularInline):
    model= Choice
    extra = 3
class PollAdmin(admin.ModelAdmin):
    #fields = ['pub_date','pub_person','question']
    fieldsets = [
        ('Publish information', {'fields':['pub_date', 'pub_person']}),
        ('Question information', {'fields':['question']})
    ]
    inlines = [ChoiceInline]
    list_display = ['question','pub_date','is_published_recently']
    search_fields =['question']
    date_hierarchy = 'pub_date'
     


class ChoiceAdmin(admin.ModelAdmin):
    pass

admin.site.register(Poll,PollAdmin)
admin.site.register(Choice, ChoiceAdmin)